import { createApp } from 'vue';
import App from './App.vue';
import router from './router';

// 引入 Font Awesome 样式
import 'font-awesome/css/font-awesome.min.css';

// 引入其他依赖
import axios from 'axios';
import qs from 'qs';

// 引入自定义工具函数
import { getCurDate, setSessionStorage, getSessionStorage, removeSessionStorage, setLocalStorage, getLocalStorage, removeLocalStorage } from './common.js';

// 创建 Vue 应用实例
const app = createApp(App);

// 将 axios 和其他工具函数挂载到全局属性
app.config.globalProperties.$axios = axios;
app.config.globalProperties.$qs = qs;
app.config.globalProperties.$getCurDate = getCurDate;
app.config.globalProperties.$setSessionStorage = setSessionStorage;
app.config.globalProperties.$getSessionStorage = getSessionStorage;
app.config.globalProperties.$removeSessionStorage = removeSessionStorage;
app.config.globalProperties.$setLocalStorage = setLocalStorage;
app.config.globalProperties.$getLocalStorage = getLocalStorage;
app.config.globalProperties.$removeLocalStorage = removeLocalStorage;

// 配置 axios 的默认 baseURL
axios.defaults.baseURL = 'http://localhost:8080/elm/';

// 使用 Vue Router
app.use(router);

// 挂载应用到 DOM
app.mount('#app');
